#!/bin/bash

ls zcy/*.wav > list.txt
for eachFile in $(cat list.txt)
do
    if [ !-f ${eachFile%.*}.mp3 ] ;then
        echo "$eachFile ==> ${eachFile%.*}.mp3"
        ffmpeg -i ${eachFile} -acodec libmp3lame -channel 1 -sample_rate 16000 ${eachFile%.*}.mp3
    fi
done

ls zcy/*.mp3 > list.txt
cat /dev/null > concat-list.txt
for eachFile in $(cat list.txt)
do
    echo "file $eachFile"
done > concat-list.txt

# ffmpeg -i concat:$concatlist -c copy ../merge.mp4
ffmpeg -f concat -safe 0 -i concat-list.txt -c copy ../merge.mp3
rm -f list.txt
rm -f concat-list.txt

